inspector: redo property editing
authorMatthias Clasen <mclasen@redhat.com>
Sun, 18 May 2014 05:03:24 +0000 (01:03 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 18 May 2014 15:43:13 +0000 (11:43 -0400)
Move away from cell editing, and use a popover instead. This makes
it easier to e.g. use a color chooser - there's just not enough room
in a cell for many things.

Much of this code is adapted from tests/prop-editor.c.

gtk/inspector/Makefile.am
gtk/inspector/init.c
gtk/inspector/prop-editor.c [new file with mode: 0644]
gtk/inspector/prop-editor.h [new file with mode: 0644]
gtk/inspector/prop-list.c
gtk/inspector/prop-list.ui
gtk/inspector/property-cell-renderer.c [deleted file]
gtk/inspector/property-cell-renderer.h [deleted file]
gtk/inspector/window.c

index a5c778c12e358e5fbf44d1d0f72e68ddeeb64a97..3a604233c8a849245f304ae1b0696be708702a90 100644 (file)
@@ -32,10 +32,10 @@ libgtkinspector_la_SOURCES =                \
        inspect-button.c                \
        object-hierarchy.h              \
        object-hierarchy.c              \
+       prop-editor.h                   \
+       prop-editor.c                   \
        prop-list.h                     \
        prop-list.c                     \
-       property-cell-renderer.h        \
-       property-cell-renderer.c        \
        python-hooks.h                  \
        python-hooks.c                  \
        python-shell.h                  \
index c3cae4f3616d840b79de5676644b6d289506b4f3..a82b6f275921fcb186c426f0e55525e7010a4cf7 100644 (file)
@@ -29,7 +29,6 @@
 #include "data-list.h"
 #include "general.h"
 #include "object-hierarchy.h"
-#include "property-cell-renderer.h"
 #include "prop-list.h"
 #include "python-hooks.h"
 #include "python-shell.h"
@@ -56,7 +55,6 @@ gtk_inspector_init (void)
   g_type_ensure (GTK_TYPE_INSPECTOR_DATA_LIST);
   g_type_ensure (GTK_TYPE_INSPECTOR_GENERAL);
   g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY);
-  g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
   g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST);
   g_type_ensure (GTK_TYPE_INSPECTOR_PYTHON_SHELL);
   g_type_ensure (GTK_TYPE_INSPECTOR_RESOURCE_LIST);
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
new file mode 100644 (file)
index 0000000..c6a4e75
--- /dev/null
@@ -0,0 +1,1199 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "prop-editor.h"
+#include "widget-tree.h"
+
+struct _GtkInspectorPropEditorPrivate
+{
+  GObject *object;
+  char *name;
+  gboolean is_child_property;
+  GtkWidget *editor;
+};
+
+enum
+{
+  PROP_0,
+  PROP_OBJECT,
+  PROP_NAME,
+  PROP_IS_CHILD_PROPERTY
+};
+
+enum
+{
+  SHOW_OBJECT,
+  N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = { 0 };
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropEditor, gtk_inspector_prop_editor, GTK_TYPE_BOX);
+
+static gboolean
+is_child_property (GParamSpec *pspec)
+{
+  return g_param_spec_get_qdata (pspec, g_quark_from_string ("is-child-prop")) != NULL;
+}
+
+static GParamSpec *
+mark_child_property (GParamSpec *pspec)
+{
+  if (pspec)
+    g_param_spec_set_qdata (pspec, g_quark_from_string ("is-child-prop"), GINT_TO_POINTER (TRUE));
+  return pspec;
+}
+
+static GParamSpec *
+find_property (GtkInspectorPropEditor *editor)
+{
+  if (editor->priv->is_child_property)
+    {
+      GtkWidget *widget = GTK_WIDGET (editor->priv->object);
+      GtkWidget *parent = gtk_widget_get_parent (widget);
+
+      return mark_child_property (gtk_container_class_find_child_property (G_OBJECT_GET_CLASS (parent), editor->priv->name));
+    }
+
+  return g_object_class_find_property (G_OBJECT_GET_CLASS (editor->priv->object), editor->priv->name);
+}
+
+typedef struct
+{
+  gpointer instance;
+  GObject *alive_object;
+  gulong id;
+} DisconnectData;
+
+static void
+disconnect_func (gpointer data)
+{
+  DisconnectData *dd = data;
+
+  g_signal_handler_disconnect (dd->instance, dd->id);
+}
+
+static void
+signal_removed (gpointer  data,
+                GClosure *closure)
+{
+  DisconnectData *dd = data;
+
+  g_object_steal_data (dd->alive_object, "alive-object-data");
+  g_free (dd);
+}
+
+static void
+g_object_connect_property (GObject    *object,
+                           GParamSpec *spec,
+                           GCallback   func,
+                           gpointer    data,
+                           GObject    *alive_object)
+{
+  GClosure *closure;
+  gchar *with_detail;
+  DisconnectData *dd;
+
+  if (is_child_property (spec))
+    with_detail = g_strconcat ("child-notify::", spec->name, NULL);
+  else
+    with_detail = g_strconcat ("notify::", spec->name, NULL);
+
+  dd = g_new (DisconnectData, 1);
+
+  closure = g_cclosure_new (func, data, NULL);
+  g_closure_add_invalidate_notifier (closure, dd, signal_removed);
+  dd->id = g_signal_connect_closure (object, with_detail, closure, FALSE);
+  dd->instance = object;
+  dd->alive_object = alive_object;
+
+  g_object_set_data_full (G_OBJECT (alive_object), "alive-object-data",
+                          dd, disconnect_func);
+
+  g_free (with_detail);
+}
+
+typedef struct
+{
+  GObject *obj;
+  GParamSpec *spec;
+  gulong modified_id;
+} ObjectProperty;
+
+static void
+free_object_property (ObjectProperty *p)
+{
+  g_free (p);
+}
+
+static void
+connect_controller (GObject     *controller,
+                    const gchar *signal,
+                    GObject     *model,
+                    GParamSpec  *spec,
+                    GCallback    func)
+{
+  ObjectProperty *p;
+
+  p = g_new (ObjectProperty, 1);
+  p->obj = model;
+  p->spec = spec;
+
+  p->modified_id = g_signal_connect_data (controller, signal, func, p,
+                                          (GClosureNotify)free_object_property, 0);
+  g_object_set_data (controller, "object-property", p);
+}
+
+static void
+block_controller (GObject *controller)
+{
+  ObjectProperty *p = g_object_get_data (controller, "object-property");
+
+  if (p)
+    g_signal_handler_block (controller, p->modified_id);
+}
+
+static void
+unblock_controller (GObject *controller)
+{
+  ObjectProperty *p = g_object_get_data (controller, "object-property");
+
+  if (p)
+    g_signal_handler_unblock (controller, p->modified_id);
+}
+
+static void
+get_property_value (GObject *object, GParamSpec *pspec, GValue *value)
+{
+  if (is_child_property (pspec))
+    {
+      GtkWidget *widget = GTK_WIDGET (object);
+      GtkWidget *parent = gtk_widget_get_parent (widget);
+
+      gtk_container_child_get_property (GTK_CONTAINER (parent),
+                                        widget, pspec->name, value);
+    }
+  else
+    g_object_get_property (object, pspec->name, value);
+}
+
+static void
+set_property_value (GObject *object, GParamSpec *pspec, GValue *value)
+{
+  if (is_child_property (pspec))
+    {
+      GtkWidget *widget = GTK_WIDGET (object);
+      GtkWidget *parent = gtk_widget_get_parent (widget);
+
+      gtk_container_child_set_property (GTK_CONTAINER (parent),
+                                        widget, pspec->name, value);
+    }
+  else
+    g_object_set_property (object, pspec->name, value);
+}
+
+static void
+notify_property (GObject *object, GParamSpec *pspec)
+{
+  if (is_child_property (pspec))
+    {
+      GtkWidget *widget = GTK_WIDGET (object);
+      GtkWidget *parent = gtk_widget_get_parent (widget);
+
+      gtk_container_child_notify (GTK_CONTAINER (parent), widget, pspec->name);
+    }
+  else
+    g_object_notify (object, pspec->name);
+}
+
+static void
+int_modified (GtkAdjustment *adj, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+  
+  g_value_init (&val, G_TYPE_INT);
+  g_value_set_int (&val, (int) gtk_adjustment_get_value (adj));
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+int_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkAdjustment *adj = GTK_ADJUSTMENT (data);
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, G_TYPE_INT);
+  get_property_value (object, pspec, &val);
+
+  if (g_value_get_int (&val) != (int)gtk_adjustment_get_value (adj))
+    {
+      block_controller (G_OBJECT (adj));
+      gtk_adjustment_set_value (adj, g_value_get_int (&val));
+      unblock_controller (G_OBJECT (adj));
+    }
+
+  g_value_unset (&val);
+}
+static void
+uint_modified (GtkAdjustment *adj, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+  
+  g_value_init (&val, G_TYPE_UINT);
+  g_value_set_uint (&val, (guint) gtk_adjustment_get_value (adj));
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+uint_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkAdjustment *adj = GTK_ADJUSTMENT (data);
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, G_TYPE_UINT);
+  get_property_value (object, pspec, &val);
+
+  if (g_value_get_uint (&val) != (guint)gtk_adjustment_get_value (adj))
+    {
+      block_controller (G_OBJECT (adj));
+      gtk_adjustment_set_value (adj, g_value_get_uint (&val));
+      unblock_controller (G_OBJECT (adj));
+    }
+
+  g_value_unset (&val);
+}
+
+static void
+float_modified (GtkAdjustment *adj, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+  
+  g_value_init (&val, G_TYPE_FLOAT);
+  g_value_set_float (&val, (float) gtk_adjustment_get_value (adj));
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+float_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkAdjustment *adj = GTK_ADJUSTMENT (data);
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, G_TYPE_FLOAT);
+  get_property_value (object, pspec, &val);
+
+  if (g_value_get_float (&val) != (float) gtk_adjustment_get_value (adj))
+    {
+      block_controller (G_OBJECT (adj));
+      gtk_adjustment_set_value (adj, g_value_get_float (&val));
+      unblock_controller (G_OBJECT (adj));
+    }
+
+  g_value_unset (&val);
+}
+
+static void
+double_modified (GtkAdjustment *adj, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+  
+  g_value_init (&val, G_TYPE_DOUBLE);
+  g_value_set_double (&val, gtk_adjustment_get_value (adj));
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+double_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkAdjustment *adj = GTK_ADJUSTMENT (data);
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, G_TYPE_DOUBLE);
+  get_property_value (object, pspec, &val);
+
+  if (g_value_get_double (&val) != gtk_adjustment_get_value (adj))
+    {
+      block_controller (G_OBJECT (adj));
+      gtk_adjustment_set_value (adj, g_value_get_double (&val));
+      unblock_controller (G_OBJECT (adj));
+    }
+
+  g_value_unset (&val);
+}
+
+static void
+string_modified (GtkEntry *entry, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+  
+  g_value_init (&val, G_TYPE_STRING);
+  g_value_set_static_string (&val, gtk_entry_get_text (entry));
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+string_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkEntry *entry = GTK_ENTRY (data);
+  GValue val = G_VALUE_INIT;
+  const gchar *str;
+  const gchar *text;
+
+  g_value_init (&val, G_TYPE_STRING);
+  get_property_value (object, pspec, &val);
+
+  str = g_value_get_string (&val);
+  if (str == NULL)
+    str = "";
+  text = gtk_entry_get_text (entry);
+  if (g_strcmp0 (str, text) != 0)
+    {
+      block_controller (G_OBJECT (entry));
+      gtk_entry_set_text (entry, str);
+      unblock_controller (G_OBJECT (entry));
+    }
+
+  g_value_unset (&val);
+}
+
+static void
+bool_modified (GtkToggleButton *tb, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, G_TYPE_BOOLEAN);
+  g_value_set_boolean (&val, gtk_toggle_button_get_active (tb));
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkToggleButton *tb = GTK_TOGGLE_BUTTON (data);
+  GtkWidget *child;
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, G_TYPE_BOOLEAN);
+  get_property_value (object, pspec, &val);
+
+  if (g_value_get_boolean (&val) != gtk_toggle_button_get_active (tb))
+    {
+      block_controller (G_OBJECT (tb));
+      gtk_toggle_button_set_active (tb, g_value_get_boolean (&val));
+      unblock_controller (G_OBJECT (tb));
+    }
+
+  child = gtk_bin_get_child (GTK_BIN (tb));
+  gtk_label_set_text (GTK_LABEL (child),
+                      g_value_get_boolean (&val) ? "TRUE" : "FALSE");
+
+  g_value_unset (&val);
+}
+
+static void
+enum_modified (GtkToggleButton *button, ObjectProperty *p)
+{
+  gint i;
+  GEnumClass *eclass;
+  GValue val = G_VALUE_INIT;
+
+  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+    return;
+
+  eclass = G_ENUM_CLASS (g_type_class_peek (p->spec->value_type));
+  i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index"));
+
+  g_value_init (&val, p->spec->value_type);
+  g_value_set_enum (&val, eclass->values[i].value);
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkWidget *viewport;
+  GtkWidget *box;
+  GList *children, *c;
+  GValue val = G_VALUE_INIT;
+  GEnumClass *eclass;
+  gint i, j;
+
+  eclass = G_ENUM_CLASS (g_type_class_peek (pspec->value_type));
+
+  g_value_init (&val, pspec->value_type);
+  get_property_value (object, pspec, &val);
+
+  i = 0;
+  while (i < eclass->n_values)
+    {
+      if (eclass->values[i].value == g_value_get_enum (&val))
+        break;
+      ++i;
+    }
+  g_value_unset (&val);
+
+  viewport = gtk_bin_get_child (GTK_BIN (data));
+  box = gtk_bin_get_child (GTK_BIN (viewport));
+  children = gtk_container_get_children (GTK_CONTAINER (box));
+
+  for (c = children; c; c = c->next)
+    block_controller (G_OBJECT (c->data));
+
+  for (c = children, j = 0; c; c = c->next, j++)
+    {
+      if (j == i)
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->data), TRUE);
+    }
+
+  for (c = children; c; c = c->next)
+    unblock_controller (G_OBJECT (c->data));
+}
+
+static void
+flags_modified (GtkCheckButton *button, ObjectProperty *p)
+{
+  gboolean active;
+  GFlagsClass *fclass;
+  guint flags;
+  gint i;
+  GValue val = G_VALUE_INIT;
+
+  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+  i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index"));
+  fclass = G_FLAGS_CLASS (g_type_class_peek (p->spec->value_type));
+
+  g_value_init (&val, p->spec->value_type);
+  get_property_value (p->obj, p->spec, &val);
+  flags = g_value_get_flags (&val);
+  if (active)
+    flags |= fclass->values[i].value;
+  else
+    flags &= ~fclass->values[i].value;
+  g_value_set_flags (&val, flags);
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+flags_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GList *children, *c;
+  GValue val = G_VALUE_INIT;
+  GFlagsClass *fclass;
+  guint flags;
+  gint i;
+  GtkWidget *viewport;
+  GtkWidget *box;
+
+  fclass = G_FLAGS_CLASS (g_type_class_peek (pspec->value_type));
+
+  g_value_init (&val, pspec->value_type);
+  get_property_value (object, pspec, &val);
+  flags = g_value_get_flags (&val);
+  g_value_unset (&val);
+
+  viewport = gtk_bin_get_child (GTK_BIN (data));
+  box = gtk_bin_get_child (GTK_BIN (viewport));
+  children = gtk_container_get_children (GTK_CONTAINER (box));
+
+  for (c = children; c; c = c->next)
+    block_controller (G_OBJECT (c->data));
+
+  for (c = children, i = 0; c; c = c->next, i++)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->data),
+                                  (fclass->values[i].value & flags) != 0);
+
+  for (c = children; c; c = c->next)
+    unblock_controller (G_OBJECT (c->data));
+
+  g_list_free (children);
+}
+
+static gunichar
+unichar_get_value (GtkEntry *entry)
+{
+  const gchar *text = gtk_entry_get_text (entry);
+
+  if (text[0])
+    return g_utf8_get_char (text);
+  else
+    return 0;
+}
+
+static void
+unichar_modified (GtkEntry *entry, ObjectProperty *p)
+{
+  gunichar u = unichar_get_value (entry);
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, p->spec->value_type);
+  g_value_set_uint (&val, u);
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+static void
+unichar_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkEntry *entry = GTK_ENTRY (data);
+  gunichar new_val;
+  gunichar old_val = unichar_get_value (entry);
+  GValue val = G_VALUE_INIT;
+  gchar buf[7];
+  gint len;
+
+  g_value_init (&val, pspec->value_type);
+  get_property_value (object, pspec, &val);
+  new_val = (gunichar)g_value_get_uint (&val);
+
+  if (new_val != old_val)
+    {
+      if (!new_val)
+        len = 0;
+      else
+        len = g_unichar_to_utf8 (new_val, buf);
+
+      buf[len] = '\0';
+
+      block_controller (G_OBJECT (entry));
+      gtk_entry_set_text (entry, buf);
+      unblock_controller (G_OBJECT (entry));
+    }
+}
+static void
+pointer_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkLabel *label = GTK_LABEL (data);
+  gchar *str;
+  gpointer ptr;
+
+  g_object_get (object, pspec->name, &ptr, NULL);
+
+  str = g_strdup_printf ("Pointer: %p", ptr);
+  gtk_label_set_text (label, str);
+  g_free (str);
+}
+
+static gchar *
+object_label (GObject *obj, GParamSpec *pspec)
+{
+  const gchar *name;
+
+  if (obj)
+    name = g_type_name (G_TYPE_FROM_INSTANCE (obj));
+  else if (pspec)
+    name = g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec));
+  else
+    name = "unknown";
+  return g_strdup_printf ("Object: %p (%s)", obj, name);
+}
+
+static void
+object_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkWidget *label, *button;
+  gchar *str;
+  GObject *obj;
+
+  GList *children = gtk_container_get_children (GTK_CONTAINER (data));
+  label = GTK_WIDGET (children->data);
+  button = GTK_WIDGET (children->next->data);
+  g_object_get (object, pspec->name, &obj, NULL);
+  g_list_free (children);
+
+  str = object_label (obj, pspec);
+
+  gtk_label_set_text (GTK_LABEL (label), str);
+  gtk_widget_set_sensitive (button, G_IS_OBJECT (obj));
+
+  if (obj)
+    g_object_unref (obj);
+
+  g_free (str);
+}
+
+static void
+object_properties (GtkInspectorPropEditor *editor)
+{
+  GObject *obj;
+
+  g_object_get (editor->priv->object, editor->priv->name, &obj, NULL);
+  if (G_IS_OBJECT (obj))
+    g_signal_emit (editor, signals[SHOW_OBJECT], 0, obj, editor->priv->name);
+}
+
+static void
+rgba_modified (GtkColorButton *cb, GParamSpec *ignored, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, p->spec->value_type);
+  g_object_get_property (G_OBJECT (cb), "rgba", &val);
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+rgba_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkColorChooser *cb = GTK_COLOR_CHOOSER (data);
+  GValue val = G_VALUE_INIT;
+  GdkRGBA *color;
+  GdkRGBA cb_color;
+
+  g_value_init (&val, GDK_TYPE_RGBA);
+  get_property_value (object, pspec, &val);
+
+  color = g_value_get_boxed (&val);
+  gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cb), &cb_color);
+
+  if (color != NULL && !gdk_rgba_equal (color, &cb_color))
+    {
+      block_controller (G_OBJECT (cb));
+      gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cb), color);
+      unblock_controller (G_OBJECT (cb));
+    }
+ g_value_unset (&val);
+}
+
+static void
+color_modified (GtkColorButton *cb, GParamSpec *ignored, ObjectProperty *p)
+{
+  GdkRGBA rgba;
+  GdkColor color;
+  GValue val = G_VALUE_INIT;
+
+  gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cb), &rgba);
+  color.red = 65535 * rgba.red;
+  color.green = 65535 * rgba.green;
+  color.blue = 65535 * rgba.blue;
+
+  g_value_init (&val, p->spec->value_type);
+  g_value_set_boxed (&val, &color);
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+color_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkColorChooser *cb = GTK_COLOR_CHOOSER (data);
+  GValue val = G_VALUE_INIT;
+  GdkColor *color;
+  GdkRGBA rgba;
+
+  g_value_init (&val, GDK_TYPE_COLOR);
+  get_property_value (object, pspec, &val);
+  color = g_value_get_boxed (&val);
+  rgba.red = color->red / 65535.0;
+  rgba.green = color->green / 65535.0;
+  rgba.blue = color->blue / 65535.0;
+  rgba.alpha = 1.0;
+
+  if (g_value_get_boxed (&val))
+    {
+      block_controller (G_OBJECT (cb));
+      gtk_color_chooser_set_rgba (cb, &rgba);
+      unblock_controller (G_OBJECT (cb));
+    }
+
+  g_value_unset (&val);
+}
+
+static void
+font_modified (GtkFontChooser *fb, GParamSpec *pspec, ObjectProperty *p)
+{
+  GValue val = G_VALUE_INIT;
+
+  g_value_init (&val, PANGO_TYPE_FONT_DESCRIPTION);
+  g_object_get_property (G_OBJECT (fb), "font-desc", &val);
+  set_property_value (p->obj, p->spec, &val);
+  g_value_unset (&val);
+}
+
+static void
+font_changed (GObject *object, GParamSpec *pspec, gpointer data)
+{
+  GtkFontChooser *fb = GTK_FONT_CHOOSER (data);
+  GValue val = G_VALUE_INIT;
+  const PangoFontDescription *font_desc;
+  PangoFontDescription *fb_font_desc;
+
+  g_value_init (&val, PANGO_TYPE_FONT_DESCRIPTION);
+  get_property_value (object, pspec, &val);
+
+  font_desc = g_value_get_boxed (&val);
+  fb_font_desc = gtk_font_chooser_get_font_desc (fb);
+
+  if (font_desc == NULL ||
+      (fb_font_desc != NULL &&
+       !pango_font_description_equal (fb_font_desc, font_desc)))
+    {
+      block_controller (G_OBJECT (fb));
+      gtk_font_chooser_set_font_desc (fb, font_desc);
+      unblock_controller (G_OBJECT (fb));
+    }
+
+  g_value_unset (&val);
+  pango_font_description_free (fb_font_desc);
+}
+
+static GtkWidget *
+property_widget (GObject                *object,
+                 GParamSpec             *spec,
+                 GtkInspectorPropEditor *editor)
+{
+  GtkWidget *prop_edit;
+  GtkAdjustment *adj;
+  gchar *msg;
+  GType type = G_PARAM_SPEC_TYPE (spec);
+
+  if (type == G_TYPE_PARAM_INT)
+    {
+      adj = gtk_adjustment_new (G_PARAM_SPEC_INT (spec)->default_value,
+                                G_PARAM_SPEC_INT (spec)->minimum,
+                                G_PARAM_SPEC_INT (spec)->maximum,
+                                1,
+                                MAX ((G_PARAM_SPEC_INT (spec)->maximum - G_PARAM_SPEC_INT (spec)->minimum) / 10, 1),
+                                0.0);
+
+      prop_edit = gtk_spin_button_new (adj, 1.0, 0);
+
+      g_object_connect_property (object, spec, G_CALLBACK (int_changed), adj, G_OBJECT (adj)); 
+
+      connect_controller (G_OBJECT (adj), "value_changed",
+                          object, spec, G_CALLBACK (int_modified));
+    }
+  else if (type == G_TYPE_PARAM_UINT)
+    {
+      adj = gtk_adjustment_new (G_PARAM_SPEC_UINT (spec)->default_value,
+                                G_PARAM_SPEC_UINT (spec)->minimum,
+                                G_PARAM_SPEC_UINT (spec)->maximum,
+                                1,
+                                MAX ((G_PARAM_SPEC_UINT (spec)->maximum - G_PARAM_SPEC_UINT (spec)->minimum) / 10, 1),
+                                0.0);
+
+      prop_edit = gtk_spin_button_new (adj, 1.0, 0);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (uint_changed),
+                                 adj, G_OBJECT (adj));
+
+      connect_controller (G_OBJECT (adj), "value_changed",
+                          object, spec, G_CALLBACK (uint_modified));
+    }
+  else if (type == G_TYPE_PARAM_FLOAT)
+    {
+      adj = gtk_adjustment_new (G_PARAM_SPEC_FLOAT (spec)->default_value,
+                                G_PARAM_SPEC_FLOAT (spec)->minimum,
+                                G_PARAM_SPEC_FLOAT (spec)->maximum,
+                                0.1,
+                                MAX ((G_PARAM_SPEC_FLOAT (spec)->maximum - G_PARAM_SPEC_FLOAT (spec)->minimum) / 10, 0.1),
+                                0.0);
+
+      prop_edit = gtk_spin_button_new (adj, 0.1, 2);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (float_changed),
+                                 adj, G_OBJECT (adj));
+
+      connect_controller (G_OBJECT (adj), "value_changed",
+                          object, spec, G_CALLBACK (float_modified));
+    }
+  else if (type == G_TYPE_PARAM_DOUBLE)
+    {
+      adj = gtk_adjustment_new (G_PARAM_SPEC_DOUBLE (spec)->default_value,
+                                G_PARAM_SPEC_DOUBLE (spec)->minimum,
+                                G_PARAM_SPEC_DOUBLE (spec)->maximum,
+                                0.1,
+                                MAX ((G_PARAM_SPEC_DOUBLE (spec)->maximum - G_PARAM_SPEC_DOUBLE (spec)->minimum) / 10, 0.1),
+                                0.0);
+
+      prop_edit = gtk_spin_button_new (adj, 0.1, 2);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (double_changed),
+                                 adj, G_OBJECT (adj));
+
+      connect_controller (G_OBJECT (adj), "value_changed",
+                          object, spec, G_CALLBACK (double_modified));
+    }
+  else if (type == G_TYPE_PARAM_STRING)
+    {
+      prop_edit = gtk_entry_new ();
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (string_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+
+      connect_controller (G_OBJECT (prop_edit), "changed",
+                          object, spec, G_CALLBACK (string_modified));
+    }
+  else if (type == G_TYPE_PARAM_BOOLEAN)
+    {
+      prop_edit = gtk_toggle_button_new_with_label ("");
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (bool_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+
+      connect_controller (G_OBJECT (prop_edit), "toggled",
+                          object, spec, G_CALLBACK (bool_modified));
+    }
+  else if (type == G_TYPE_PARAM_ENUM)
+    {
+      {
+        GtkWidget *box;
+        GEnumClass *eclass;
+        GtkWidget *first;
+        gint j;
+
+        prop_edit = gtk_scrolled_window_new (NULL, NULL);
+        g_object_set (prop_edit,
+                      "expand", TRUE,
+                      "hscrollbar-policy", GTK_POLICY_NEVER,
+                      "vscrollbar-policy", GTK_POLICY_NEVER,
+                      NULL);
+        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        gtk_widget_show (box);
+        gtk_container_add (GTK_CONTAINER (prop_edit), box);
+
+        eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
+
+        j = 0;
+        first = NULL;
+        while (j < eclass->n_values)
+          {
+            GtkWidget *b;
+
+            b = gtk_radio_button_new_with_label_from_widget ((GtkRadioButton*)first, eclass->values[j].value_name);
+            if (first == NULL)
+              first = b;
+            g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j));
+            gtk_widget_show (b);
+            gtk_box_pack_start (GTK_BOX (box), b, FALSE, FALSE, 0);
+            connect_controller (G_OBJECT (b), "toggled",
+                                object, spec, G_CALLBACK (enum_modified));
+            ++j;
+          }
+
+        if (j >= 10)
+          g_object_set (prop_edit, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
+
+        g_type_class_unref (eclass);
+
+        g_object_connect_property (object, spec,
+                                   G_CALLBACK (enum_changed),
+                                   prop_edit, G_OBJECT (prop_edit));
+      }
+    }
+  else if (type == G_TYPE_PARAM_FLAGS)
+    {
+      {
+        GtkWidget *box;
+        GFlagsClass *fclass;
+        gint j;
+
+        prop_edit = gtk_scrolled_window_new (NULL, NULL);
+        g_object_set (prop_edit,
+                      "expand", TRUE,
+                      "hscrollbar-policy", GTK_POLICY_NEVER,
+                      "vscrollbar-policy", GTK_POLICY_NEVER,
+                      NULL);
+        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+        gtk_widget_show (box);
+        gtk_container_add (GTK_CONTAINER (prop_edit), box);
+
+        fclass = G_FLAGS_CLASS (g_type_class_ref (spec->value_type));
+
+        for (j = 0; j < fclass->n_values; j++)
+          {
+            GtkWidget *b;
+
+            b = gtk_check_button_new_with_label (fclass->values[j].value_name);
+            g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j));
+            gtk_widget_show (b);
+            gtk_box_pack_start (GTK_BOX (box), b, FALSE, FALSE, 0);
+            connect_controller (G_OBJECT (b), "toggled",
+                                object, spec, G_CALLBACK (flags_modified));
+          }
+
+        if (j >= 10)
+          g_object_set (prop_edit, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
+
+        g_type_class_unref (fclass);
+
+        g_object_connect_property (object, spec,
+                                   G_CALLBACK (flags_changed),
+                                   prop_edit, G_OBJECT (prop_edit));
+      }
+    }
+  else if (type == G_TYPE_PARAM_UNICHAR)
+    {
+      prop_edit = gtk_entry_new ();
+      gtk_entry_set_max_length (GTK_ENTRY (prop_edit), 1);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (unichar_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+
+      connect_controller (G_OBJECT (prop_edit), "changed",
+                          object, spec, G_CALLBACK (unichar_modified));
+    }
+  else if (type == G_TYPE_PARAM_POINTER)
+    {
+      prop_edit = gtk_label_new ("");
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (pointer_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+    }
+  else if (type == G_TYPE_PARAM_OBJECT)
+    {
+      GtkWidget *label, *button;
+
+      prop_edit = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
+
+      label = gtk_label_new ("");
+      button = gtk_button_new_with_label ("Properties");
+      g_signal_connect_swapped (button, "clicked",
+                                G_CALLBACK (object_properties),
+                                editor);
+
+      gtk_container_add (GTK_CONTAINER (prop_edit), label);
+      gtk_container_add (GTK_CONTAINER (prop_edit), button);
+      gtk_widget_show (label);
+      gtk_widget_show (button);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (object_changed),
+                                 prop_edit, G_OBJECT (label));
+    }
+  else if (type == G_TYPE_PARAM_BOXED &&
+           G_PARAM_SPEC_VALUE_TYPE (spec) == GDK_TYPE_RGBA)
+    {
+      prop_edit = gtk_color_chooser_widget_new ();
+      gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (prop_edit), TRUE);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (rgba_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+
+      connect_controller (G_OBJECT (prop_edit), "notify::rgba",
+                          object, spec, G_CALLBACK (rgba_modified));
+    }
+  else if (type == G_TYPE_PARAM_BOXED &&
+           G_PARAM_SPEC_VALUE_TYPE (spec) == GDK_TYPE_COLOR)
+    {
+      prop_edit = gtk_color_chooser_widget_new ();
+      gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (prop_edit), FALSE);
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (color_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+
+      connect_controller (G_OBJECT (prop_edit), "notify::rgba",
+                          object, spec, G_CALLBACK (color_modified));
+    }
+  else if (type == G_TYPE_PARAM_BOXED &&
+           G_PARAM_SPEC_VALUE_TYPE (spec) == PANGO_TYPE_FONT_DESCRIPTION)
+    {
+      prop_edit = gtk_font_chooser_widget_new ();
+
+      g_object_connect_property (object, spec,
+                                 G_CALLBACK (font_changed),
+                                 prop_edit, G_OBJECT (prop_edit));
+
+      connect_controller (G_OBJECT (prop_edit), "notify::font-desc",
+                          object, spec, G_CALLBACK (font_modified));
+    }
+  else
+    {
+      msg = g_strdup_printf ("uneditable property type: %s",
+                             g_type_name (G_PARAM_SPEC_TYPE (spec)));
+      prop_edit = gtk_label_new (msg);
+      g_free (msg);
+      gtk_widget_set_halign (prop_edit, GTK_ALIGN_START);
+      gtk_widget_set_valign (prop_edit, GTK_ALIGN_CENTER);
+    }
+
+  if (g_param_spec_get_blurb (spec))
+    gtk_widget_set_tooltip_text (prop_edit, g_param_spec_get_blurb (spec));
+
+  notify_property (object, spec);
+
+  return prop_edit;
+}
+
+static void
+gtk_inspector_prop_editor_init (GtkInspectorPropEditor *editor)
+{
+  editor->priv = gtk_inspector_prop_editor_get_instance_private (editor);
+  g_object_set (editor,
+                "orientation", GTK_ORIENTATION_VERTICAL,
+                "spacing", 10,
+                "margin", 10,
+                NULL);
+}
+
+static void
+constructed (GObject *object)
+{
+  GtkInspectorPropEditor *editor = GTK_INSPECTOR_PROP_EDITOR (object);
+  GParamSpec *spec;
+  GtkWidget *label;
+  gboolean can_modify;
+
+  spec = find_property (editor);
+
+  label = gtk_label_new (g_param_spec_get_nick (spec));
+  gtk_widget_show (label);
+  gtk_container_add (GTK_CONTAINER (editor), label);
+
+  can_modify = ((spec->flags & G_PARAM_WRITABLE) != 0 &&
+                (spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0);
+
+  if (can_modify)
+    {
+      editor->priv->editor = property_widget (editor->priv->object, spec, editor);
+      gtk_widget_show (editor->priv->editor);
+      gtk_container_add (GTK_CONTAINER (editor), editor->priv->editor);
+    }
+}
+
+static void
+get_property (GObject    *object,
+              guint       param_id,
+              GValue     *value,
+              GParamSpec *pspec)
+{
+  GtkInspectorPropEditor *r = GTK_INSPECTOR_PROP_EDITOR (object);
+
+  switch (param_id)
+    {
+    case PROP_OBJECT:
+      g_value_set_object (value, r->priv->object);
+      break;
+
+    case PROP_NAME:
+      g_value_set_string (value, r->priv->name);
+      break;
+
+    case PROP_IS_CHILD_PROPERTY:
+      g_value_set_boolean (value, r->priv->is_child_property);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+    }
+}
+
+static void
+set_property (GObject      *object,
+              guint         param_id,
+              const GValue *value,
+              GParamSpec   *pspec)
+{
+  GtkInspectorPropEditor *r = GTK_INSPECTOR_PROP_EDITOR (object);
+
+  switch (param_id)
+    {
+    case PROP_OBJECT:
+      r->priv->object = g_value_get_object (value);
+      break;
+
+    case PROP_NAME:
+      g_free (r->priv->name);
+      r->priv->name = g_value_dup_string (value);
+      break;
+
+    case PROP_IS_CHILD_PROPERTY:
+      r->priv->is_child_property = g_value_get_boolean (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+    } 
+}
+
+static void
+gtk_inspector_prop_editor_class_init (GtkInspectorPropEditorClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->constructed = constructed;
+  object_class->get_property = get_property;
+  object_class->set_property = set_property;
+
+  signals[SHOW_OBJECT] =
+    g_signal_new ("show-object",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GtkInspectorPropEditorClass, show_object),
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_STRING);
+
+  g_object_class_install_property (object_class, PROP_OBJECT,
+      g_param_spec_object ("object", "Object", "The object owning the property",
+                           G_TYPE_OBJECT, G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+
+  g_object_class_install_property (object_class, PROP_NAME,
+      g_param_spec_string ("name", "Name", "The property name",
+                           NULL, G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+
+  g_object_class_install_property (object_class, PROP_IS_CHILD_PROPERTY,
+      g_param_spec_boolean ("is-child-property", "Child property", "Child property",
+                            FALSE, G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+}
+
+GtkWidget *
+gtk_inspector_prop_editor_new (GObject     *object,
+                               const gchar *name,
+                               gboolean     is_child_property)
+{
+  return g_object_new (GTK_TYPE_INSPECTOR_PROP_EDITOR,
+                       "object", object,
+                       "name", name,
+                       "is-child-property", is_child_property,
+                       NULL);
+}
+
+gboolean
+gtk_inspector_prop_editor_should_expand (GtkInspectorPropEditor *editor)
+{
+  if (GTK_IS_SCROLLED_WINDOW (editor->priv->editor))
+    {
+      GtkPolicyType policy;
+
+      g_object_get (editor->priv->editor, "vscrollbar-policy", &policy, NULL);
+      if (policy != GTK_POLICY_NEVER)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+
+// vim: set et:
diff --git a/gtk/inspector/prop-editor.h b/gtk/inspector/prop-editor.h
new file mode 100644 (file)
index 0000000..8febf33
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GTK_INSPECTOR_PROP_EDITOR_H_
+#define _GTK_INSPECTOR_PROP_EDITOR_H_
+
+
+#include <gtk/gtk.h>
+
+
+#define GTK_TYPE_INSPECTOR_PROP_EDITOR            (gtk_inspector_prop_editor_get_type())
+#define GTK_INSPECTOR_PROP_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROP_EDITOR, GtkInspectorPropEditor))
+#define GTK_INSPECTOR_PROP_EDITOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROP_EDITOR, GtkInspectorPropEditorClass))
+#define GTK_INSPECTOR_IS_PROP_EDITOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROP_EDITOR))
+#define GTK_INSPECTOR_IS_PROP_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROP_EDITOR))
+#define GTK_INSPECTOR_PROP_EDITOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROP_EDITOR, GtkInspectorPropEditorClass))
+
+typedef struct _GtkInspectorPropEditorPrivate GtkInspectorPropEditorPrivate;
+
+typedef struct
+{
+  GtkBox parent;
+  GtkInspectorPropEditorPrivate *priv;
+} GtkInspectorPropEditor;
+
+typedef struct
+{
+  GtkBoxClass parent;
+
+  void (*show_object) (GtkInspectorPropEditor *editor, GObject *object, const gchar *name);
+} GtkInspectorPropEditorClass;
+
+
+G_BEGIN_DECLS
+
+
+GType      gtk_inspector_prop_editor_get_type (void);
+GtkWidget *gtk_inspector_prop_editor_new      (GObject     *object,
+                                               const gchar *name,
+                                               gboolean     is_child_property);
+
+gboolean   gtk_inspector_prop_editor_should_expand (GtkInspectorPropEditor *editor);
+
+G_END_DECLS
+
+
+#endif // _GTK_INSPECTOR_PROP_EDITOR_H_
+
+// vim: set et:
index aad8759d287a6bcf1ee995500b38fd91401f186e..89367a06e4271f409dd8384dc9f3d5a282e4cfa7 100644 (file)
@@ -22,7 +22,8 @@
  */
 
 #include "prop-list.h"
-#include "property-cell-renderer.h"
+#include "prop-editor.h"
+#include "widget-tree.h"
 
 
 enum
@@ -49,8 +50,7 @@ struct _GtkInspectorPropListPrivate
   GtkListStore *model;
   GHashTable *prop_iters;
   gulong notify_handler_id;
-  GtkWidget *widget_tree;
-  GtkCellRenderer *value_renderer;
+  GtkInspectorWidgetTree *widget_tree;
   gboolean child_properties;
   GtkTreeViewColumn *attribute_column;
   GtkWidget *tree;
@@ -108,14 +108,10 @@ set_property (GObject      *object,
     {
       case PROP_WIDGET_TREE:
         pl->priv->widget_tree = g_value_get_object (value);
-        g_object_set_data (G_OBJECT (pl->priv->value_renderer), "gtk-inspector-widget-tree", pl->priv->widget_tree);
         break;
 
       case PROP_CHILD_PROPERTIES:
         pl->priv->child_properties = g_value_get_boolean (value);
-        g_object_set (pl->priv->value_renderer,
-                      "is-child-property", pl->priv->child_properties,
-                      NULL);
         break;
 
       default:
@@ -124,6 +120,68 @@ set_property (GObject      *object,
     }
 }
 
+static void
+show_object (GtkInspectorPropEditor *editor,
+             GObject                *object,
+             const gchar            *name,
+             GtkInspectorPropList   *pl)
+{
+  GtkTreeIter iter;
+  GtkWidget *popover;
+
+  popover = gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_POPOVER);
+  gtk_widget_hide (popover);
+
+  if (gtk_inspector_widget_tree_find_object (pl->priv->widget_tree, object, &iter))
+    {
+      gtk_inspector_widget_tree_select_object (pl->priv->widget_tree, object);
+    }
+  else if (gtk_inspector_widget_tree_find_object (pl->priv->widget_tree, pl->priv->object, &iter))
+    {
+      gtk_inspector_widget_tree_append_object (pl->priv->widget_tree, object, &iter, name);
+      gtk_inspector_widget_tree_select_object (pl->priv->widget_tree, object);
+    }
+  else
+    {
+      g_warning ("GtkInspector: couldn't find the widget in the tree");
+    }
+}
+
+static void
+row_activated (GtkTreeView *tv,
+               GtkTreePath *path,
+               GtkTreeViewColumn *col,
+               GtkInspectorPropList *pl)
+{
+  GtkTreeIter iter;
+  GdkRectangle rect;
+  gchar *name;
+  GtkWidget *editor;
+  GtkWidget *popover;
+
+  gtk_tree_model_get_iter (GTK_TREE_MODEL (pl->priv->model), &iter, path);
+  gtk_tree_model_get (GTK_TREE_MODEL (pl->priv->model), &iter, COLUMN_NAME, &name, -1);
+  gtk_tree_view_get_cell_area (tv, path, col, &rect);
+  gtk_tree_view_convert_bin_window_to_widget_coords (tv, rect.x, rect.y, &rect.x, &rect.y);
+
+  popover = gtk_popover_new (GTK_WIDGET (tv));
+  gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
+
+  editor = gtk_inspector_prop_editor_new (pl->priv->object, name, pl->priv->child_properties);
+  gtk_widget_show (editor);
+
+  gtk_container_add (GTK_CONTAINER (popover), editor);
+
+  if (gtk_inspector_prop_editor_should_expand (GTK_INSPECTOR_PROP_EDITOR (editor)))
+    gtk_widget_set_vexpand (popover, TRUE);
+
+  g_signal_connect (editor, "show-object", G_CALLBACK (show_object), pl);
+
+  gtk_widget_show (popover);
+
+  g_free (name);
+}
+
 static void
 gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
 {
@@ -142,9 +200,9 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/prop-list.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, model);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, value_renderer);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, attribute_column);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, tree);
+  gtk_widget_class_bind_template_callback (widget_class, row_activated);
 }
 
 static void
index f13d5c211cfa150275708556996751010a93cc35..0eade8fd9b63526582f99a68edeb5409e8074722 100644 (file)
@@ -26,6 +26,8 @@
             <property name="visible">True</property>
             <property name="model">model</property>
             <property name="tooltip-column">4</property>
+            <property name="activate-on-single-click">True</property>
+            <signal name="row-activated" handler="row_activated"/>
             <child>
               <object class="GtkTreeViewColumn">
                 <property name="title" translatable="yes">Property</property>
                 <property name="title" translatable="yes">Value</property>
                 <property name="resizable">True</property>
                 <child>
-                  <object class="GtkInspectorPropertyCellRenderer" id="value_renderer">
+                  <object class="GtkCellRendererText">
                     <property name="scale">0.8</property>
-                    <property name="editable">True</property>
+                    <property name="editable">False</property>
                     <property name="width-chars">20</property>
                     <property name="ellipsize">end</property>
                   </object>
                   <attributes>
                     <attribute name="text">1</attribute>
-                    <attribute name="object">3</attribute>
-                    <attribute name="name">0</attribute>
                     <attribute name="sensitive">5</attribute>
                   </attributes>
                 </child>
diff --git a/gtk/inspector/property-cell-renderer.c b/gtk/inspector/property-cell-renderer.c
deleted file mode 100644 (file)
index ab3c361..0000000
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "property-cell-renderer.h"
-#include "widget-tree.h"
-
-struct _GtkInspectorPropertyCellRendererPrivate
-{
-  GObject *object;
-  char *name;
-  gboolean is_child_property;
-};
-
-enum
-{
-  PROP_0,
-  PROP_OBJECT,
-  PROP_NAME,
-  PROP_IS_CHILD_PROPERTY
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropertyCellRenderer, gtk_inspector_property_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT);
-
-static void
-gtk_inspector_property_cell_renderer_init(GtkInspectorPropertyCellRenderer *renderer)
-{
-  renderer->priv = gtk_inspector_property_cell_renderer_get_instance_private (renderer);
-}
-
-static void
-get_property (GObject    *object,
-              guint       param_id,
-              GValue     *value,
-              GParamSpec *pspec)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
-
-  switch (param_id)
-    {
-    case PROP_OBJECT:
-      g_value_set_object(value, r->priv->object);
-      break;
-
-    case PROP_NAME:
-      g_value_set_string(value, r->priv->name);
-      break;
-
-    case PROP_IS_CHILD_PROPERTY:
-      g_value_set_boolean (value, r->priv->is_child_property);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
-      break;
-    }
-}
-
-static void
-set_property (GObject      *object,
-              guint         param_id,
-              const GValue *value,
-              GParamSpec   *pspec)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
-
-  switch (param_id)
-    {
-    case PROP_OBJECT:
-      r->priv->object = g_value_get_object (value);
-      break;
-
-    case PROP_NAME:
-      g_free (r->priv->name);
-      r->priv->name = g_value_dup_string (value);
-      break;
-
-    case PROP_IS_CHILD_PROPERTY:
-      r->priv->is_child_property = g_value_get_boolean (value);
-      g_object_notify (object, "is-child-property");
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
-      break;
-    } 
-}
-
-static GParamSpec *
-find_property (GtkCellRenderer *renderer)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  if (r->priv->is_child_property)
-    {
-      GtkWidget *parent;
-
-      parent = gtk_widget_get_parent (GTK_WIDGET (r->priv->object));
-
-      return gtk_container_class_find_child_property (G_OBJECT_GET_CLASS (parent), r->priv->name);
-    }
-
-  return g_object_class_find_property (G_OBJECT_GET_CLASS (r->priv->object), r->priv->name);
-}
-
-static void
-get_value (GtkCellRenderer *renderer,
-           GValue          *gvalue)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  if (r->priv->is_child_property)
-    {
-      GtkWidget *widget;
-      GtkWidget *parent;
-
-      widget = GTK_WIDGET (r->priv->object);
-      parent = gtk_widget_get_parent (widget);
-
-      gtk_container_child_get_property (GTK_CONTAINER (parent), widget, r->priv->name, gvalue);
-    }
-  else
-    g_object_get_property (r->priv->object, r->priv->name, gvalue);
-}
-
-static void
-set_value (GtkCellRenderer *renderer,
-           GValue          *gvalue)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  if (r->priv->is_child_property)
-    {
-      GtkWidget *widget;
-      GtkWidget *parent;
-
-      widget = GTK_WIDGET (r->priv->object);
-      parent = gtk_widget_get_parent (widget);
-
-      gtk_container_child_set_property (GTK_CONTAINER (parent), widget, r->priv->name, gvalue);
-    }
-  else
-    g_object_set_property (r->priv->object, r->priv->name, gvalue);
-}
-
-static void
-stop_editing (GtkCellEditable *editable,
-              GtkCellRenderer *renderer)
-{
-  GValue gvalue = {0};
-  GParamSpec *prop;
-
-  prop = find_property (renderer);
-  g_value_init(&gvalue, prop->value_type);
-
-  if (GTK_IS_ENTRY(editable))
-    {
-      gboolean canceled;
-
-      g_object_get (editable, "editing-canceled", &canceled, NULL);
-      gtk_cell_renderer_stop_editing (renderer, canceled);
-
-      if (canceled)
-        return;
-
-      if (GTK_IS_SPIN_BUTTON(editable))
-        {
-          gdouble value = g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (editable)), NULL);
-
-          if (G_IS_PARAM_SPEC_INT (prop))
-            g_value_set_int (&gvalue, (gint)value);
-          else if G_IS_PARAM_SPEC_UINT (prop)
-            g_value_set_uint (&gvalue, (guint)value);
-          else if G_IS_PARAM_SPEC_INT64 (prop)
-            g_value_set_int64 (&gvalue, (gint64)value);
-          else if G_IS_PARAM_SPEC_UINT64 (prop)
-            g_value_set_uint64 (&gvalue, (guint64)value);
-          else if G_IS_PARAM_SPEC_LONG (prop)
-            g_value_set_long (&gvalue, (glong)value);
-          else if G_IS_PARAM_SPEC_ULONG (prop)
-            g_value_set_ulong (&gvalue, (gulong)value);
-          else if G_IS_PARAM_SPEC_DOUBLE (prop)
-            g_value_set_double (&gvalue, (gdouble)value);
-          else
-            return;
-        }
-      else
-        {
-          g_value_set_string (&gvalue, gtk_entry_get_text (GTK_ENTRY (editable)));
-        }
-    }
-  else if (GTK_IS_COMBO_BOX (editable))
-    {
-      /* We have no way of getting the canceled state for a GtkComboBox */
-      gtk_cell_renderer_stop_editing (renderer, FALSE);
-
-      if (G_IS_PARAM_SPEC_BOOLEAN (prop))
-        {
-          g_value_set_boolean (&gvalue, gtk_combo_box_get_active (GTK_COMBO_BOX (editable)) == 1);
-        }
-      else if (G_IS_PARAM_SPEC_ENUM (prop))
-        {
-          gchar *enum_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (editable));
-          GEnumClass *enum_class;
-          GEnumValue *enum_value;
-
-          if (enum_name == NULL)
-            return;
-
-          enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
-          enum_value = g_enum_get_value_by_name (enum_class, enum_name);
-          g_value_set_enum (&gvalue, enum_value->value);
-
-          g_free (enum_name);
-        }
-    }
-
-  set_value (renderer, &gvalue);
-  g_value_unset (&gvalue);
-}
-
-static GtkCellEditable *
-start_editing (GtkCellRenderer      *renderer,
-               GdkEvent             *event,
-               GtkWidget            *widget,
-               const gchar          *path,
-               const GdkRectangle   *background_area,
-               const GdkRectangle   *cell_area,
-               GtkCellRendererState  flags)
-{
-  PangoFontDescription *font_desc;
-  GtkCellEditable *editable = NULL;
-  GValue gvalue = {0};
-  GParamSpec *prop;
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  prop = find_property (renderer);
-
-  g_value_init (&gvalue, prop->value_type);
-
-  get_value (renderer, &gvalue);
-
-  if (G_VALUE_HOLDS_OBJECT (&gvalue))
-    {
-      GtkInspectorWidgetTree *widget_tree = g_object_get_data (G_OBJECT (renderer), "gtk-inspector-widget-tree");
-      GObject *prop_object = g_value_get_object (&gvalue);
-      GtkTreeIter iter;
-
-      if (prop_object)
-        {
-          /* First check if the value is already in the tree (happens with 'parent' for instance) */
-          if (gtk_inspector_widget_tree_find_object (widget_tree, prop_object, &iter))
-            {
-              gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
-            }
-          else if (gtk_inspector_widget_tree_find_object (widget_tree, r->priv->object, &iter))
-            {
-              gtk_inspector_widget_tree_append_object (widget_tree, prop_object, &iter, prop->name);
-              gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
-            }
-          else
-            {
-              g_warning ("GtkInspector: couldn't find the widget in the tree");
-            }
-        }
-      g_value_unset (&gvalue);
-      return NULL;
-    }
-  else
-    {
-      if (!(prop->flags & G_PARAM_WRITABLE))
-        return NULL;
-
-      if (G_VALUE_HOLDS_ENUM (&gvalue) || G_VALUE_HOLDS_BOOLEAN (&gvalue))
-        {
-          GtkWidget *combobox;
-          GList *renderers;
-
-          combobox = gtk_combo_box_text_new ();
-          gtk_widget_show (combobox);
-          g_object_set (G_OBJECT (combobox), "has-frame", FALSE, NULL);
-
-          if (G_VALUE_HOLDS_BOOLEAN (&gvalue))
-            {
-              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), "FALSE");
-              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), "TRUE");
-
-              gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), g_value_get_boolean (&gvalue) ? 1 : 0);
-            }
-          else if (G_VALUE_HOLDS_ENUM(&gvalue))
-            {
-              gint value = g_value_get_enum (&gvalue);
-              GEnumClass *enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
-              guint i;
-
-              for (i = 0; i < enum_class->n_values; i++)
-                {
-                  GEnumValue *enum_value = &enum_class->values[i];
-
-                  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox),
-                                                  enum_value->value_name);
-
-                  if (enum_value->value == value)
-                    gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), i);
-                }
-            }
-
-          renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (combobox));
-          g_object_set (G_OBJECT (renderers->data), "scale", 0.8, NULL);
-          g_list_free (renderers);
-
-          editable = GTK_CELL_EDITABLE (combobox);
-        }
-      else if (G_VALUE_HOLDS_STRING (&gvalue))
-        {
-          GtkWidget *entry;
-
-          entry = gtk_entry_new ();
-          gtk_widget_show (entry);
-          gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (&gvalue));
-
-          editable = GTK_CELL_EDITABLE (entry);
-        }
-      else if (G_VALUE_HOLDS_INT (&gvalue)    ||
-               G_VALUE_HOLDS_UINT (&gvalue)   ||
-               G_VALUE_HOLDS_INT64 (&gvalue)  ||
-               G_VALUE_HOLDS_UINT64 (&gvalue) ||
-               G_VALUE_HOLDS_LONG (&gvalue)   ||
-               G_VALUE_HOLDS_ULONG (&gvalue)  ||
-               G_VALUE_HOLDS_DOUBLE (&gvalue))
-        {
-          gdouble min, max, value;
-          GtkWidget *spinbutton;
-          guint digits = 0;
-
-          if (G_VALUE_HOLDS_INT (&gvalue))
-            {
-              GParamSpecInt *paramspec = G_PARAM_SPEC_INT (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_int (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_UINT (&gvalue))
-            {
-              GParamSpecUInt *paramspec = G_PARAM_SPEC_UINT (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_uint (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_INT64 (&gvalue))
-            {
-              GParamSpecInt64 *paramspec = G_PARAM_SPEC_INT64 (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_int64 (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_UINT64 (&gvalue))
-            {
-              GParamSpecUInt64 *paramspec = G_PARAM_SPEC_UINT64 (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_uint64 (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_LONG (&gvalue))
-            {
-              GParamSpecLong *paramspec = G_PARAM_SPEC_LONG (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_long (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_ULONG (&gvalue))
-            {
-              GParamSpecULong *paramspec = G_PARAM_SPEC_ULONG (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_ulong (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_DOUBLE (&gvalue))
-            {
-              GParamSpecDouble *paramspec = G_PARAM_SPEC_DOUBLE (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_double (&gvalue);
-              digits = 2;
-            }
-          else
-            {
-              /* Shouldn't really be able to happen. */
-              return NULL;
-            }
-
-          spinbutton = gtk_spin_button_new_with_range (min, max, 1);
-          gtk_widget_show (spinbutton);
-          gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton), value);
-          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
-
-          editable = GTK_CELL_EDITABLE(spinbutton);
-        }
-    }
-
-  g_value_unset (&gvalue);
-
-  if (!editable)
-    return NULL;
-
-  font_desc = pango_font_description_new ();
-  pango_font_description_set_size (font_desc, 8 * PANGO_SCALE);
-  gtk_widget_override_font (GTK_WIDGET (editable), font_desc);
-  pango_font_description_free (font_desc);
-
-  g_signal_connect (editable, "editing-done", G_CALLBACK (stop_editing), renderer);
-
-  return editable;
-}
-
-static void
-gtk_inspector_property_cell_renderer_class_init (GtkInspectorPropertyCellRendererClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
-
-  object_class->get_property = get_property;
-  object_class->set_property = set_property;
-
-  cell_class->start_editing = start_editing;
-
-  g_object_class_install_property (object_class, PROP_OBJECT,
-      g_param_spec_object ("object", "Object", "The object owning the property",
-                           G_TYPE_OBJECT, G_PARAM_READWRITE));
-
-  g_object_class_install_property (object_class, PROP_NAME,
-      g_param_spec_string ("name", "Name", "The property name",
-                           NULL, G_PARAM_READWRITE));
-
-  g_object_class_install_property (object_class, PROP_IS_CHILD_PROPERTY,
-      g_param_spec_boolean ("is-child-property", "Child property", "Child property",
-                            FALSE, G_PARAM_READWRITE));
-}
-
-
-// vim: set et ts=2:
diff --git a/gtk/inspector/property-cell-renderer.h b/gtk/inspector/property-cell-renderer.h
deleted file mode 100644 (file)
index 45cac80..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
-#define _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
-
-
-#include <gtk/gtk.h>
-
-
-#define GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER            (gtk_inspector_property_cell_renderer_get_type())
-#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRenderer))
-#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
-#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
-#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
-#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
-
-typedef struct _GtkInspectorPropertyCellRendererPrivate GtkInspectorPropertyCellRendererPrivate;
-
-typedef struct
-{
-  GtkCellRendererText parent;
-  GtkInspectorPropertyCellRendererPrivate *priv;
-} GtkInspectorPropertyCellRenderer;
-
-typedef struct
-{
-  GtkCellRendererTextClass parent;
-} GtkInspectorPropertyCellRendererClass;
-
-
-G_BEGIN_DECLS
-
-
-GType            gtk_inspector_property_cell_renderer_get_type (void);
-
-
-G_END_DECLS
-
-
-#endif // _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
-
-// vim: set et sw=2 ts=2:
index 87605f2586f1d8fc78dfc247c76b0686bbeee236..4d8b27f02ec0066a2bcd8f564bbc989f1e5c5519 100644 (file)
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include "window.h"
 #include "prop-list.h"
-#include "property-cell-renderer.h"
 #include "classes-list.h"
 #include "css-editor.h"
 #include "object-hierarchy.h"